<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">

<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />

<title>出现旅游</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 美国服务 <span class="c-gray en">&gt;</span> 出现旅游 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="pd-20" style="padding-top: 5px;">
	<div class="cl pd-5 bg-1 bk-gray"> 
	<span class="l"><a class="btn btn-primary radius" onclick="picture_add('添加图片','month-add.html?url=travel.html')" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 添加系列图片</a></span>
	 <label><a id="com" style="color:blue;" title="评论" href="javascript:;" onclick="comment('comment-list.html?sid=a6b1293f6b62451198830ab613ae5164');" class="ml-5"><i class="Hui-iconfont">评论</i></a></label>
	 <span class="r">共有数据：<strong id="sum">0</strong> 条</span> 
	 </div>
	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr class="text-c">
					<th width="150">标题</th>
					<th width="150">图片</th>
					<th width="150">更新时间</th>
					<th width="50">操作</th>
				</tr>
			</thead>

			<tbody id="str">
				<!-- <tr class="text-c">
					<td>001</td>
					<td><a href="picture-show.html" title="">账号</a></td>
					<td><img width="100" class="picture-thumb" src="pic/200x150.jpg"></a></td>
					<td>2014-6-11 11:11:42</td>
					<td> <a title="评论" href="javascript:;" onclick="comment('评论','comment-list.html','4','800','600')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">评论</i></a></td>
					<td class="td-manage"><a style="text-decoration:none" class="ml-5" onClick="picture_del(this,'10001')" href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a></td>
				</tr> -->
			</tbody>
			
		</table>
	</div>
</div>
<div id="page1" style="float: right;"></div>
<div style="clear: both;"></div>
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script> 
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="js/H-ui.js"></script> 
<script type="text/javascript" src="js/H-ui.admin.js"></script> 

<script type="text/javascript">


$(function(){
demo();

});

function demo(curr){
	var key=$("#key").val();
// alert(key);
    $.ajax( {  
		     url:'/baby/usaBabyMonth/queryUsaBabyMonth',// 跳转到 action  
		     data:{
		     	pageNum : curr
		     	,key:key
		     	,menutype:"a6b1293f6b62451198830ab613ae5164"
		     },  
		     type:'post',  
		     cache:false,  
		     dataType:'json',  
		     success:function(data) { 
		         if(data.code =="2000" ){ 
		             // alert(data.data.totalRowNumber); 
		             console.log(data); 
		              if(data.data==null ){
		             	alert("没有找到数据");
		             	return
		             }
		             var datalist= data.data.dataList;
		             
		             //拼页面
		             var s=data.data.totalRowNumber;
		             document.getElementById("sum").innerHTML=s
		            var comm='';
		             var htmlstr='';
		             for (var i=0;i<datalist.length;i++){
			             	var obj = datalist[i];//获取单个数据对象
			             	var sid = '\'' +obj.sid+ '\'';
				             var imgurl='';
				             if(obj.img==null){
				             	imgurl='./images/nullimg.jpg';		             	
				             }else{
				             	imgurl=obj.img.realPicUrl;		             	
				             }
			             	
			             	htmlstr+='<tr class="text-c">'
			             	+'<td>'+obj.title+'</td>'
			             	+'<td><img style="max-height:150px;max-width:100px;" src="'+imgurl+'" alt="" style="height:150px;"></td>'
			             	+'<td>'+obj.createTime+'</td>'
			             /* 	+comm */
			             	+'<td class="td-manage">'
			             	+'<a style="text-decoration:none" class="ml-5" href="month-edit.html?sid='+obj.sid+'&url=travel.html" title="编辑"><i class="Hui-iconfont">&#xe6df;</i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration:none" class="ml-5 delate" value="\''+obj.sid+'\'" onClick="picture_del(this,\''+obj.sid+'\')" href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a>'
		/* 	             	+'<a style="text-decoration:none" class="ml-5" href="eat-edit.html?sid='+obj.sid+'" title="编辑"><i class="Hui-iconfont">&#xe6df;</i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration:none" class="ml-5 delate" value="\''+obj.sid+'\'" onClick="picture_del(this,\''+obj.sid+'\')" href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a>' */
			             	+'</tr>'
			             }
					document.getElementById("str").innerHTML =htmlstr
		             laypage({
					    cont: $('#page1'), //容器。值支持id名、原生dom对象，jquery对象,
					    pages:data.data.totalRowNumber, //总页数
					    skip: true, //是否开启跳页
					    groups: 5, //连续显示分页数
					    curr: data.data.currentPage, //当前页
					    pages:data.data.totalPage,
					    jump: function(obj, first){
					    //得到了当前页，用于向服务端请求对应数据
					    var curr = obj.curr;
					    	if(!first){
								demo(curr);	
					    	}
						}
					});

		         }else if(data.code =="5001" ){
					alert(data.message); 
					 window.parent.location.href='http://localhost:8080/baby/resource/admin/login.html'
	             	console.log(data);  
		         	 
		         }  
		      }, error : function() {      
		             // view("异常！");  
		          alert("异常！");  
		     }  
		});
};



/*图片-添加*/
function picture_add(title,url){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}



/*图片-编辑*/
function picture_edit(id){
	var title="美妈秀编辑";
	var url="mom-picture-update.html?sid="+id
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}


/*删除*/
function picture_del(obj,id){
	$.ajax( {  	
		url:'/baby/usaBabyMonth/deleteUsaBabyMonth',// 跳转到 action  
		data:{id:id},  
		type:'post',  
		cache:false,  
		dataType:'json',  
		success:function(data) { 
	     	if(data.code =="2000" ){ 
	     		alert(data.message);
	     		location.reload(); 
	     	}else{
	     		alert(data.message);
	     	}
	    }, 
	    error : function() {      
	    	alert("异常！");  
		}  
	});
}

// 打开评论
function comment(url){
	layer_show('评论',url,"800","800");
}
</script>
</body>
</html>